package cn.tannn.tcache.command.set;

import cn.tannn.tcache.core.Command;
import cn.tannn.tcache.core.Reply;
import cn.tannn.tcache.core.Tcache;

/**
 * 判断 member 元素是否是集合 key 的成员
 * <p> 	SISMEMBER key member
 *
 * @author <a href="https://t.tannn.cn/">tnnn</a>
 * @version V1.0
 * @date 2024/6/19 下午9:46
 */
public class SismemberCommand implements Command {
    @Override
    public String name() {
        return "SISMEMBER";
    }

    @Override
    public Reply<?> exec(Tcache cache, String[] args) {
        String key = getKey(args);
        String val = getVal(args);
        return Reply.integer(cache.sismember(key, val));
    }
}
